Skip to content

chore: Properly compute finalized block (#21156)#21594

Draft
AztecBot wants to merge 19 commits intobackport-to-v4-next-stagingfrom
claudebox/backport-finalized-block-v4-next
Draft

chore: Properly compute finalized block (#21156)#21594
AztecBot wants to merge 19 commits intobackport-to-v4-next-stagingfrom
claudebox/backport-finalized-block-v4-next

Conversation

@AztecBot
Copy link
Collaborator

Summary

Backport of #21156 to v4-next.

Replaces the heuristic finalized block computation (provenBlock - 2 * epochDuration) with L1 finality. On each archiver sync iteration, the finalized L1 block is fetched and the proven checkpoint number at that block is persisted as the finalized checkpoint.

Backport Details

Cherry-pick of squash merge commit 078737feff from next. Three conflicts were resolved:

  1. factory.ts — Removed L1RollupConstants import (no longer needed after constructor change; DataStoreConfig already imported from @aztec/kv-store/config on v4-next)
  2. block_store.ts — Kept getEpochAtSlot import (still used by getSettledTxReceipt on v4-next), removed only L1RollupConstants from constructor
  3. start_anvil.ts — Kept v4-next's createAnvil pattern (vs next's spawn pattern), added slotsInAnEpoch parameter with type assertion

Additional v4-next adaptations (commit 3):

  • Re-added L1RollupConstants import in block_store.ts and kv_archiver_store.ts (still used by getSettledTxReceipt)
  • Removed epochDuration arg from KVArchiverDataStore in archiver-misc.test.ts
  • Used type assertion for slotsInAnEpoch in createAnvil (not yet in @viem/anvil types)

Commit Structure

  1. Cherry-pick with conflicts — raw cherry-pick with conflict markers
  2. Conflict resolution — resolves the three merge conflicts
  3. Build fixes — adapts for v4-next-specific code differences

ClaudeBox log: https://claudebox.work/s/27d9debbc14214be?run=1

AztecBot and others added 19 commits March 12, 2026 18:30
…20932)

Backports two fixes from `next` that enable the AVM transpiler for `linux/arm64` release builds, resolving [#20793](#20793) — `aztec compile` fails with "AVM Transpiler is not enabled" on `linux/arm64`.

**Cherry-picked from:**
- #20814 — added `arm64-linux` cross-compile to `avm-transpiler/bootstrap.sh` + wired `AVM_TRANSPILER_LIB` in `CMakePresets.json`
- #20932 — fixed Makefile dependency (`bb-cpp-cross-arm64-linux` was depending on `avm-transpiler-native` instead of `avm-transpiler-cross-arm64-linux`), plus `barretenberg-rs` release fix

**Root cause:** The `zig-arm64-linux` CMake preset was missing `AVM_TRANSPILER_LIB`, and `avm-transpiler/bootstrap.sh` had no `arm64-linux` case in `build_cross`. The arm64-linux bb binary was compiled without `ENABLE_AVM_TRANSPILER`.

**Changes:**
- `avm-transpiler/bootstrap.sh` — add `arm64-linux` case to `build_cross`
- `barretenberg/cpp/CMakePresets.json` — wire `AVM_TRANSPILER_LIB` for `zig-arm64-linux` preset
- `Makefile` — add `avm-transpiler-cross-arm64-linux` target, fix `bb-cpp-cross-arm64-linux` dependency
- `barretenberg/rust/bootstrap.sh` — add `release` function with on-the-fly binding generation
- `barretenberg/ts/scripts/copy_cross.sh` — relax arch check for release context

**Conflict resolution:** `barretenberg/rust/bootstrap.sh` had a minor conflict — the `release` function didn't exist on v4. Resolved by accepting the full function.

- [x] Native avm-transpiler build succeeds
- [x] Makefile targets verified: `avm-transpiler-cross-arm64-linux`, `bb-cpp-cross-arm64-linux` dependency corrected
- [x] CMake preset verified: `zig-arm64-linux` has `AVM_TRANSPILER_LIB` pointing to correct cross-compiled path
- [ ] Full cross-compilation validated in release CI

Closes #20793

ClaudeBox log: http://ci.aztec-labs.com/596d4a62f30fd2f0-2
Fixes the orchestrator limiting the number of in-progress jobs, now it only limits the actual enqueuing operation and gives the event loop more room to breath.

Either this PR must be backported or the previous PR #21247 must be removed the from the backport train.
## Summary
- Lower `SLASH_INACTIVITY_TARGET_PERCENTAGE` from 0.8 to 0.7
- Disable `SLASH_DUPLICATE_PROPOSAL_PENALTY` and
`SLASH_DUPLICATE_ATTESTATION_PENALTY` (set to 0)
- Increase `SLASH_GRACE_PERIOD_L2_SLOTS` from 1200 to 8400
- Reduce `perBlockAllocationMultiplier` from 2 to 1.2

## Test plan
- Verify generated config files are updated after running `yarn
generate` in relevant packages
- Deploy to devnet/testnet and confirm slasher behavior matches new
parameters

---------

Co-authored-by: Aztec Bot <49558828+AztecBot@users.noreply.github.com>
This PR was created because merging `v4` into `v4-next` resulted in
conflicts.

Please resolve the conflicts and merge this PR to keep `v4-next` up to
date.

This PR was auto-generated by the `pull-v4-into-v4-next` workflow.
…21463)

## Summary

Backport of #21231
to `v4`.

Cherry-pick of merge commit `a8b2277a50` with two conflicts resolved:
- `docs/docs-developers/docs/resources/migration_notes.md` — accepted
incoming migration notes entries
- `yarn-project/archiver/src/store/block_store.ts` — included
`getEpochAtSlot` import

### Commit structure
1. **Cherry-pick commit** — raw cherry-pick with conflict markers
preserved for review
2. **Conflict resolution commit** — resolved the two conflicts above

No additional build fixes were needed — the code compiles cleanly on v4.

ClaudeBox log: https://claudebox.work/s/8bd8c8724c80cbb2?run=1
## Motivation

The JSON-RPC server already returns `x-aztec-*` headers for protocol
component versions (chain id, rollup address, etc.), but does not
include the node's package version. This makes it harder to identify
which software version a node is running when debugging or monitoring.

## Approach

Extended `getVersioningMiddleware` to accept an optional
`packageVersion` parameter and emit it as an `x-aztec-packageVersion`
response header alongside existing versioning headers.

## Example

```
$ curl -s -D- http://localhost:8090 -H 'content-type: application/json' -d '[{"jsonrpc":"2.0","id":1,"method":"node_getNodeVersion","params":[]}]'
HTTP/1.1 200 OK
Vary: Accept-Encoding, Origin
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
x-aztec-l2CircuitsVkTreeRoot: 0x06624799e2080c43aba671cdece34d5f4cdff2122bc6be41d80bd903ca0975cc
x-aztec-l2ProtocolContractsHash: 0x23c2022f0b69b29e354b4f7612d5db3ba0bc4259d71ac9186ed272945a644b9c
x-aztec-packageVersion: 5.0.0
Content-Length: 43
Date: Fri, 13 Mar 2026 16:04:31 GMT
Connection: keep-alive
Keep-Alive: timeout=5

[{"jsonrpc":"2.0","id":1,"result":"5.0.0"}]
```

## Changes

- **stdlib**: Updated `getVersioningMiddleware` to accept an optional
`opts` bag with `packageVersion`, setting `x-aztec-packageVersion`
header when provided
- **aztec**: Wired `getPackageVersion()` into both the main and admin
RPC server middleware calls

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…lup compatibility (#21537)

## Summary

- Adds `getVkTreeRoot()` and `getProtocolContractsHash()` methods to
`RollupContract` that read immutable config from L1 storage slots
(stfStorageSlot + 3 and + 4)
- Extends `waitForCompatibleRollup` to verify all three values (genesis
archive root, VK tree root, protocol contracts hash) before allowing the
node to proceed
- Prevents nodes from starting against a rollup deployed with
incompatible circuits or protocol contracts

## Test plan

- Added unit tests for `getVkTreeRoot` and `getProtocolContractsHash` in
`rollup.test.ts` that verify storage slot arithmetic against values set
during deployment
- Existing `waitForCompatibleRollup` behavior preserved: enters standby
mode on mismatch, polls until compatible rollup found
Reimplementation of
#21471. I did the
filtering in-memory as explained there due to lack of indices.

Additionally I fixed a bug in which certain index tuples were ignored -
e.g. if `afterLog` and `txHash` were both specified, `txHash` was
ignored.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BEGIN_COMMIT_OVERRIDE
fix: orchestrator enqueue yield (#21286)
chore: default multiplier (#21482)
chore: update yarn.lock (#21479)
chore: backport #21231 feat!: improve L2ToL1MessageWitness API to v4
(#21463)
feat(rpc): add package version to RPC response headers (#21526)
feat(ethereum): check VK tree root and protocol contracts hash in rollup
compatibility (#21537)
feat: add public log filtering by tag (#21561)
END_COMMIT_OVERRIDE
Cherry-pick of 078737f from next. Conflicts present in:
- yarn-project/archiver/src/factory.ts
- yarn-project/archiver/src/store/block_store.ts
- yarn-project/ethereum/src/test/start_anvil.ts
- factory.ts: removed L1RollupConstants import (not needed after PR changes, DataStoreConfig already imported from kv-store/config)
- block_store.ts: kept getEpochAtSlot import (still used), removed L1RollupConstants
- start_anvil.ts: kept v4-next createAnvil pattern, added slotsInAnEpoch parameter
- Re-add L1RollupConstants import in block_store.ts and kv_archiver_store.ts (still used by getSettledTxReceipt on v4-next)
- Remove epochDuration arg from KVArchiverDataStore in archiver-misc.test.ts
- Use type assertion for slotsInAnEpoch in createAnvil (not yet in @viem/anvil types)
@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants